<%--
 *  File:    UploadVisitFeedBack.jsp
 *  @Author: visazhou 
 *  Date:    2009/12/29
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "H0262";
  String strTableName = "";
  String strModuleName = "SFE";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>UploadSummaryContact</title>
<PageFlow:CheckPageFlow pageName="p_tempvisitfeedback"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<%
  Vector totalsummary = (Vector)pageContext.getAttribute("orgsummary");
  if(totalsummary == null) totalsummary = new Vector();

  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
%>
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "UploadVisitFeedBack.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_check()
{
    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_confirm(){
	cform.actionname.value = "confirm";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_giveup(){
	var flag1 = confirm("<%= message.getMessageDesc("SURE_GIVE_UP")%>");
	if(!flag1){
		return;
	}
	cform.actionname.value = "giveup";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}	

function page_operate(operand)
{
	if(cform.filename.value === "" || cform.filename.value === null){
		return false;
	}
		  if (operand=="upload")
		  {
		    cform.encoding="multipart/form-data";
		    cform.actionname.value = "upload";
		    cform.target = "_self";
		    cform.submit();
		  }
	  
}
function page_print(){
	var cform = document.cform;
	cform.type.value = 'xlsdata';
	cform.name.value = 'ContactUploadInformation';
	
	cform.action="<%=contextPath%>/reportDirector";
	cform.target="_blank";
	cform.submit();
	cform.action="<%=contextPath%>/Dispatcher";
}

</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_tempvisitfeedback">
    <input type="hidden" name="actionname">
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden>
<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>

    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
             <tr>
			  <td> 
			  	<%= label.getLabelName("L_Path") %><%= label.getLabelName("L_Colon") %><input type="file" name="filename" size="30" >
			    &nbsp;&nbsp;&nbsp;&nbsp;<a onclick="page_operate('upload')"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
			    
			  </td>
			 </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td>
<div style="overflow:auto;width:1000;height:300">
          <table width="3000"  border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
            <tr class="deepblue-left">
             
              <td class="title_center" >ID</td>
              <td class="title_center" ><%= label.getLabelName("L_Plan_Date") %></td>
              <td class="title_center" ><%= label.getLabelName("L_City_1") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Parent_Charge") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_Charge_Rep") %></td>
              <td class="title_center" ><%= label.getLabelName("L_CustomerType") %></td>
              <td class="title_center" ><%= label.getLabelName("L_IsChain") %></td>
              <td class="title_center" ><%= label.getLabelName("L_DS_Grade") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_CustomerCode") %></td>
              <td class="title_center" ><%= label.getLabelName("L_CustomerName") %></td>
              
              <td class="title_center" ><%= label.getLabelName("L_FeedBackDate") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Product")+label.getLabelName("L_Code") %></td>
              
              <td class="title_center" ><%= label.getLabelName("L_Sales_Commitments") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Actual_Sales") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_Inventory") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_Retail_Price") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_Production_Date") %></td>  
              <td class="title_center" ><%= label.getLabelName("L_Display_Location") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_Display_Surface") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_SingleDoubleBox") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_Pepperstring") %></td>
			  <td class="title_center"><%= label.getLabelName("L_DesktopDisplayRack") %></td>
			  <td class="title_center"><%= label.getLabelName("L_plug-in card") %></td>	
              <td class="title_center" ><%= label.getLabelName("L_Papertrapezoidbox") %></td>
              <td class="title_center"><%= label.getLabelName("L_JumpingCards") %></td>  			  			  
              <td class="title_center" ><%= label.getLabelName("L_Otherdisplay") %> </td>  
              <td class="title_center" ><%= label.getLabelName("L_Aproduct") %> </td>   
              <td class="title_center" ><%= label.getLabelName("L_Bproduct") %> </td>
              <td class="title_center" ><%= label.getLabelName("L_ErrorMsg") %> </td>               
            </tr>

<%
	int i=0;
	String strClassType="";
	String checkflag = null;
%>
            <%--  the old detail lines  --%>
 <span id="olddetail" >
            <logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx" scope="page">
<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
	  
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
	if(row.get("errormessage") != null){
		strClassType = "need";
		
	}
	checkflag = (String)row.get("checkflag");
%>
            <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'" class="<%=strClassType%>">
              <td><custom:write property="visitplandetailid" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="planvisitdate" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="areaname" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="parentcontactname" name="onerow"  nbsp="true"/></td>              
              <td><custom:write property="contactname" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="customertype" name="onerow"  nbsp="true"/></td> 
              <td><custom:write property="ischain" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="gradename" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="orgcode" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="orgname" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="feedbackdate" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="prodcode" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="salescommitments" name="onerow"  nbsp="true"/></td>              
              <td><custom:write property="actualsales" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="inventory" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="retailprice" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="productvalid" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="displaylocation" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="displaysurface" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="singledoublebox" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="pepperstring" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="desktopdisplayrack" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="plugincard" name="onerow"  nbsp="true"/></td>
              <td><custom:write property="papertrapezoidbox" name="onerow"  nbsp="true"/></td>        
              <td><custom:write property="jumpingcards" name="onerow" nbsp="true"/></td>
              <td><custom:write property="otherdisplay" name="onerow" nbsp="true"/></td>
              <td><custom:write property="apackqty" name="onerow" nbsp="true"/></td>
              <td><custom:write property="bpackqty" name="onerow" nbsp="true"/></td>
              <td><custom:write property="errormessage" name="onerow" nbsp="true"/></td>
            </tr>

            </logic:iterate>
</span>
			<tr>
				<td colspan="37" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write property="count" name="count" nbsp="true"/></td>
			</tr>

            <%@ include file="/inc/SummaryAction.inc" %>
          </table>
</div>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
	      		<%if (totalsummary.size() > 0){ 
					if(checkflag == null){
				%>
				                <a onclick="page_check();"><custom:button type="1" label="L_CheckContent" imgsrc="new.gif" border="0" style="width:60"/></a>
				<%}else if(("Y").equals(checkflag)){ %>                
				                <a onclick="javascript:page_print();"><custom:button type="1" label="L_Export" imgsrc="new.gif" border="0" style="width:60"/></a>				           
				                <a onclick="javascript:page_confirm();"><custom:button type="1" label="L_Confirm" imgsrc="new.gif" border="0" style="width:60"/></a>
				                <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a>  				                
				<%}else if(("N").equals(checkflag)){ %>
				                <a onclick="javascript:page_print();"><custom:button type="1" label="L_Export" imgsrc="new.gif" border="0" style="width:60"/></a>				           
				                
				                <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a>									                
				<%}}%>      
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>
</html>